package com.example.demo.dto;

import java.util.ArrayList;
import java.util.List;

public class DeepSeekRequest {
    private String model;
    private List<Message> messages;

    // 默认构造函数
    public DeepSeekRequest() {
        this.messages = new ArrayList<>();
    }

    // 带参构造函数
    public DeepSeekRequest(String model, List<Message> messages) {
        this.model = model;
        this.messages = messages != null ? messages : new ArrayList<>();
    }

    // Getter & Setter
    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public List<Message> getMessages() {
        return messages;
    }

    public void setMessages(List<Message> messages) {
        this.messages = messages != null ? messages : new ArrayList<>();
    }

    // 添加消息
    public void addMessage(String role, String content) {
        this.messages.add(new Message(role, content));
    }

    // 清空消息
    public void clearMessages() {
        this.messages.clear();
    }

    // 静态内部类 Message
    public static class Message {
        private String role;
        private String content;

        // 默认构造函数
        public Message() {}

        // 带参构造函数
        public Message(String role, String content) {
            this.role = role;
            this.content = content;
        }

        // Getter & Setter
        public String getRole() {
            return role;
        }

        public void setRole(String role) {
            this.role = role;
        }

        public String getContent() {
            return content;
        }

        public void setContent(String content) {
            this.content = content;
        }

        @Override
        public String toString() {
            return "Message{" +
                    "role='" + role + '\'' +
                    ", content='" + content + '\'' +
                    '}';
        }
    }

    @Override
    public String toString() {
        return "DeepSeekRequest{" +
                "model='" + model + '\'' +
                ", messages=" + messages +
                '}';
    }
}